(fn byte (x)
  (bit-and (? (< x 0)
              (+ 256 x)
              x)
           #xff))

(fn word (x)
  (bit-and (? (< x 0)
              (+ #x10000 x)
              x)
           #xffff))

(fn word-unsigned-int (x)
  (? (< #x7fff x)
     (- x #x10000)
     x))
